package com.tju.resource.oauth.controller.tb;

import com.tju.resource.annotation.Log;
import com.tju.resource.model.TbSendMatl;
import com.tju.resource.business.tb_send_matl.TbSendMatlService;
import com.tju.resource.result.Result;
import com.tju.resource.tool.enum_utils.FunctionType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 发料管理
 */
@RestController
public class TbSendMatlController {
    private final static String prefix = "send/";

    @Autowired
    private TbSendMatlService tbSendMatlService;
    @PostMapping(prefix + "list")
    @PreAuthorize("hasAuthority('sys:goods:send:list')")
    @Log(type = FunctionType.List)
    public Result<Object> selectSendMatl(@RequestBody Map<String, String> params) {
        return tbSendMatlService.selectSendMatl(params);
    }
    @PostMapping(prefix + "approve")
    @PreAuthorize("hasAuthority('sys:goods:send:approve')")
    @Log(type = FunctionType.FirstInstance)
    public Result<Object> approveSendMatl(@RequestBody TbSendMatl sendMatl) {
        return tbSendMatlService.approveSendMatl(sendMatl);
    }

}
